import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from 'store';
import Axios from 'axios';
import VueAxios from 'vue-axios';
import qs from 'qs';
import './util/element.js';
import caches from 'util/caches.js';
import $ from 'jquery'
//权限判断js
import hasPermission from 'directives/permissions/permission/hasPermission.js';
import andPermission from 'directives/permissions/permission/andPermission.js';
import orPermission from 'directives/permissions/permission/orPermission.js';
import hasDepartmentId from 'directives/permissions/department/hasDepartmentId.js';
import andDepartmentId from 'directives/permissions/department/andDepartmentId.js';
import orDepartmentId from 'directives/permissions/department/orDepartmentId.js';
import hasDepartmentName from 'directives/permissions/department/hasDepartmentName.js';
import andDepartmentName from 'directives/permissions/department/andDepartmentName.js';
import orDepartmentName from 'directives/permissions/department/orDepartmentName.js';
import hasRoleId from 'directives/permissions/role/hasRoleId.js';
import andRoleId from 'directives/permissions/role/andRoleId.js';
import orRoleId from 'directives/permissions/role/orRoleId.js';
import hasRoleName from 'directives/permissions/role/hasRoleName.js';
import andRoleName from 'directives/permissions/role/andRoleName.js';
import orRoleName from 'directives/permissions/role/orRoleName.js';
//图标选择器
import iconPicker from 'e-icon-picker';
import 'e-icon-picker/dist/index.css';
import 'e-icon-picker/dist/main.css';
Vue.use(iconPicker);
//echarts
import echarts from 'echarts'

Vue.prototype.$echarts = echarts
Vue.prototype.$http = Axios;
Vue.prototype.$qs = qs;
Vue.config.productionTip = false;
let menus = caches.menus.get();
if (menus) {
	//初始化动态路由
	store.dispatch('initRouter', menus).then(() => {
		router.addRoutes(store.getters.getAddRoutes);
	});
}
Vue.directive('hasPermission', hasPermission);
Vue.directive('andPermission', andPermission);
Vue.directive('orPermission', orPermission);
Vue.directive('hasDepartmentId', hasDepartmentId);
Vue.directive('andDepartmentId', andDepartmentId);
Vue.directive('orDepartmentId', orDepartmentId);
Vue.directive('hasDepartmentName', hasDepartmentName);
Vue.directive('andDepartmentName', andDepartmentName);
Vue.directive('orDepartmentName', orDepartmentName);
Vue.directive('hasRoleId', hasRoleId);
Vue.directive('andRoleId', andRoleId);
Vue.directive('orRoleId', orRoleId);
Vue.directive('hasRoleName', hasRoleName);
Vue.directive('andRoleName', andRoleName);
Vue.directive('orRoleName', orRoleName);

new Vue({
	router,
	store,
	render: h => h(App)
}).$mount('#app');

import moment from 'moment'

Vue.filter('dateformat', function(dataStr, pattern = 'YYYY-MM-DD') {
    return moment(dataStr).format(pattern)

})